import QtQuick 1.0
import "schemeControl.js" as SchemeControl

Rectangle {
    id : menuRoot;
    property ListModel model
    property int itemFontSize : 25
    width: 400
    height: 200
    opacity: 0
    color: "#80000000"
    MouseArea {
            id: menuMouseArea
            anchors.fill: parent
            onPressAndHold: SchemeControl.showMenu(mouse)
        }
    states: State {
       name: "visible"
       PropertyChanges {target: menuRoot; opacity: 1}
    }
    transitions: Transition {
       NumberAnimation {
         target:  menuRoot
         properties: "opacity"
         duration: 250
       }
    }
    Rectangle {
        id: menu
        width: SchemeControl.getMenuWidth() + 1;
        height: SchemeControl.getMenuHeight();
        color: "green"
        ListView {
           id: menuList
           highlight: Rectangle{ color: "lightsteelblue" }
           clip: true
           model: menuRoot.model;
           anchors.fill: parent
           delegate: Rectangle {
                    id: listViewItem
                    color: "transparent"
                    border {width: 1;color: "black"}
                    width: menu.width - 1
                    height: itemText.height
                    Text {
                        id: itemText
                        text: name
                        width: listViewItem.width
                        font.pointSize: itemFontSize
                        elide: Text.ElideRight
                    }
                }
            }
        }
}
